
public class PreFixAverage 
{

	private int length;
	private int aray[];//=new int[20];
	private float preAverage;
	
	public PreFixAverage(int len)
	{
	length = len;
	aray = new int[length];
	
	}
	 public void initArray()
	 {
		 
		 for(int i=0;i<length;i++)
		 {
			aray[i] = (17)*(int)(Math.random()*10); // random numbers
		 }
		 
		 
		 
	 }
	public float calcAverage(int pos)
	{
		int sum;
		sum =0;
		for(int j=0;j<pos;j++)
		{
			
			sum+=aray[j];
			System.out.println("sum is "+sum);
		}
		 preAverage = sum/pos;
		return preAverage;
	}
	 
public void printPreAverage()
{
	System.out.println("Pre Average is : "+preAverage);
}





}
